<template>
	<view class="operation-info">
		<backheader :title="title" :closecardflag="closecardflag" :checkflag="checkflag"></backheader>
		<view class="mainMenu">
			<view class="mmitem" :class="{mmactive: mmactiveflag === 1}" @tap="changeMm(1)">基本信息</view>
			<view class="mmitem" :class="{mmactive: mmactiveflag === 2}" @tap="changeMm(2)">危险预控</view>
			<view class="mmitem" :class="{mmactive: mmactiveflag === 3}" @tap="changeMm(3)">操作项</view>
			<view class="mmitem" :class="{mmactive: mmactiveflag === 4}" @tap="changeMm(4)">沟通汇报</view>
		</view>
		<view class="content ">
			<basic-info  v-if="mmactiveflag === 1" :otId="otId" ref="base" />
			<dangerous-info ref='dangerRef' v-if="mmactiveflag === 2" :otId="otId" />
			<action-items  v-if="mmactiveflag === 3" :otId="otId" />
			<communication-report v-if="mmactiveflag === 4" :otId="otId" />
		</view>
		<button type="primary" class="botton-btn-st" @click="execute"  v-if="mmactiveflag !== 3 && mmactiveflag !== 4">开始执行</button>
	</view>
</template>
<script>
	import backheader from "@/components/backHeader/backHeader.vue";
	import BasicInfo from "./BasicInfo.vue";
	import DangerousInfo from "./DangerousInfo.vue";
	import ActionItems from "./ActionItems.vue";
	import CommunicationReport from "./CommunicationReport.vue";

	import {
		getDangerPage,getOperateItemPage
	} from '@/api/operationPicket.js'
	export default {
		data() {
			return {
				closecardflag: true,
				title: "操作票信息",
				checkflag: false,
				mmactiveflag: 1,
				otId:'',
				current:1,
				size:10
			}
		},
		components: {
			backheader,
			BasicInfo,
			DangerousInfo,
			ActionItems,
			CommunicationReport
		},
		onLoad(option) {
			this.otId = option.id
			this.changeMm(1)
		},
		methods: {
			changeMm(index) {
				console.log(index)
				if (index == 1) {
					this.mmactiveflag = 1
				} else if (index == 2) {
					this.mmactiveflag = 2
				} else if (index == 3) {
					this.mmactiveflag = 3
					this.getOperateItemPage
				} else {
					this.mmactiveflag = 4
				}
			},	
			// 开始执行
			execute(){
			   uni.navigateTo({
				url:'/pages/twotickets/operationPicket/confirmModal/index?id='+this.otId
			   });
			}
		}
	}
</script>
<style lang="scss" scoped>
	.operation-info {
		background-color: #f6fafa;
		height: 100vh;

		.page {
			background-color: #f9f9f9;
		}

		.mainMenu {
			height: 88upx;
			line-height: 88upx;
			text-align: center;
			display: flex;
			background-color: #fff;
		}

		.mmitem {
			flex: 1;
			text-align: center;
			font-size: 28upx;
			color: #333333;
		}



		.mmactive {
			border-bottom: solid 4upx #1E91E6;
		}

		.content {
			padding: 0 3%;
			margin-top: 20upx;
		}
	}
	.botton-btn-st {
		position: fixed;
		bottom: 20upx;
		width: 90%;
		left: 5%;
	}
</style>
